package org.wadael.waverobotfrmwrk.simple;

import org.wadael.waverobotfrmwrk.LimitedObedienceRobot;

import com.google.wave.api.Blip;
import com.google.wave.api.event.Event;
import com.google.wave.api.impl.EventMessageBundle;

/**
 * Kind of robot that will not be usable by all participants, thus the "limited obedience"
 * 
 * The question of obedience groups is ... a good question.  
 * 
 * @author wadael, jerome baton
 *
 */
@SuppressWarnings("serial")
public abstract class LimitedObedienceBlipAppenderRobot extends BlipAppenderRobot {
	
	/*
	 * Need to find a way to share this with the modifier counterpart
	 * @param event
	 * @return
	 */
	public boolean shouldObey(Event event) {
		String eventStarter = event.getModifiedBy() ;
		if(getAuthorisedUsers().contains(eventStarter)) return true;
		return false;
	}

	public void whatToDoIfNotToObey(EventMessageBundle bundle, Blip blip, Event event){
		blip.reply().append("\n " +event.getModifiedBy() + " is not authorised." );
	}
	
	

}
